﻿// <copyright file="CleanableKingsCleaner.cs" company="Ecole Normale Supérieure">
// Released under GPLv2
// </copyright>
// <summary>Contains a daemon to clean logs, attacks, etc, of a king.</summary>

namespace Sqwarea.Batch
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using Lokad.Cloud.ServiceFabric;
    using Sqwarea.GameLogic;
    using Sqwarea.Persistence;
    using Sqwarea.Persistence.Azure;

    /// <summary>
    /// A daemon that takes in a kingId and clean it with cleaner in GameLogic
    /// </summary>
    [QueueServiceSettings(
        AutoStart = true,
        QueueName = QueueProvider.CleanableKingIdQueueName,
        ProcessingTimeoutSeconds = GlobalParameters.KingCleanerTimeout)]
    public class CleanableKingsCleaner : QueueService<long>
    {
        /// <summary>
        /// Gets or sets the cleaner from persistence
        /// </summary>
        public IKingCleaner KingCleaner { get; set; }

        /// <summary>
        /// Entry point of the correction of king 
        /// </summary>
        /// <param name="message">King to correct</param>
        protected override void Start(long message)
        {
            this.KingCleaner.CleanKing(message);
        }
    }
}
